import { fileURLToPath, URL } from "node:url";

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import tailwindcss from "tailwindcss";

// //启动打包插件
// import {ElectronDevPlugin} from "./plugins/vite_electron_dev";
// import {viteElectronBuild} from "./plugins/vite_electron_build";

//element plus 组件自动引入插件
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";

export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  css: {
    postcss: {
      plugins: [
        tailwindcss({
          content: ["./src/**/*.vue"],
        }),
      ],
    },
  },
  server: {
    https: false, // 是否启用https
    host: "0.0.0.0",
    port: 20102, // 指定启动端口
    open: true, //启动后是否自动打开浏览器
  },
  base: "./",
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
});
